package com.spy.material.service.impl;

import java.util.List;
import com.spy.common.utils.DateUtils;
import com.spy.material.vo.OutboundOrderDetailVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.spy.material.mapper.OutboundOrderDetailMapper;
import com.spy.material.domain.OutboundOrderDetail;
import com.spy.material.service.IOutboundOrderDetailService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.Arrays;
/**
 * 出库明细Service业务层处理
 * 
 * @author twc
 * @date 2025-11-09
 */
@Service
public class OutboundOrderDetailServiceImpl extends ServiceImpl<OutboundOrderDetailMapper, OutboundOrderDetail> implements IOutboundOrderDetailService
{
    @Autowired
    private OutboundOrderDetailMapper outboundOrderDetailMapper;

    /**
     * 查询出库明细
     * 
     * @param id 出库明细主键
     * @return 出库明细
     */
    @Override
    public OutboundOrderDetail selectOutboundOrderDetailById(Long id)
    {
                return getById(id);
    }

    /**
     * 查询出库明细列表
     * 
     * @param outboundOrderDetail 出库明细
     * @return 出库明细
     */
    @Override
    public List<OutboundOrderDetail> selectOutboundOrderDetailList(OutboundOrderDetail outboundOrderDetail)
    {
        return outboundOrderDetailMapper.selectOutboundOrderDetailList(outboundOrderDetail);
    }

    /**
     * 新增出库明细
     * 
     * @param outboundOrderDetail 出库明细
     * @return 结果
     */
    @Override
    public int insertOutboundOrderDetail(OutboundOrderDetail outboundOrderDetail)
    {
        outboundOrderDetail.setCreateTime(DateUtils.getNowDate());
                return save(outboundOrderDetail) ? 1 : 0;
    }

    /**
     * 修改出库明细
     * 
     * @param outboundOrderDetail 出库明细
     * @return 结果
     */
    @Override
    public int updateOutboundOrderDetail(OutboundOrderDetail outboundOrderDetail)
    {
        outboundOrderDetail.setUpdateTime(DateUtils.getNowDate());
                return updateById(outboundOrderDetail) ? 1 : 0;
    }

    /**
     * 批量删除出库明细
     * 
     * @param ids 需要删除的出库明细主键
     * @return 结果
     */
    @Override
    public int deleteOutboundOrderDetailByIds(Long[] ids)
    {
                return removeByIds(Arrays.asList(ids)) ? 1 : 0;
    }

    /**
     * 删除出库明细信息
     * 
     * @param id 出库明细主键
     * @return 结果
     */
    @Override
    public int deleteOutboundOrderDetailById(Long id)
    {
                return removeById(id) ? 1 : 0;
    }

    @Override
    public List<OutboundOrderDetailVO> detail(Long outboundOrderId) {
        return outboundOrderDetailMapper.detail(outboundOrderId);
    }
}
